<?php

class LoginModel extends CI_Model{

	public function __construct() {
		parent::__construct();
	}

	public function getPassword($userName) {
		$sql ='select password from users where user_name = ?';
		$query = $this->db->query($sql, array($userName));
		if ($query->num_rows() > 0)
		{
			foreach ($query->result() as $row)
			{
				return $row->password;
			}
		}
	}

	public function insertUser($userName,$password) {
		$data = array(
		   'user_name' => $userName ,
		   'password' => $password ,
		);
		return $this->db->insert('users', $data);
	}
}
?>